//
//  YGProgressBarView.m
//  YunGou
//
//  Created by macbook on 16/5/19.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "YGProgressBarView.h"
@interface YGProgressBarView (){
    UIView *foreView;
}
@end

@implementation YGProgressBarView

- (void)awakeFromNib{
    self.backgroundColor = WColor(237, 237, 237, 1);
    self.layer.cornerRadius = 3;
    self.clipsToBounds = YES;
    
    foreView = [[UIView alloc] initWithFrame:self.bounds];
    foreView.layer.cornerRadius = 3;
    self.clipsToBounds = YES;
    [self addSubview:foreView];
    foreView.backgroundColor = ThemeColor;
}

- (void)setProgress:(double)progress{
    _progress = progress;
    [self setNeedsLayout];
}

- (void)layoutSubviews{
    CGRect frame = foreView.frame;
    frame.size.width = _progress * self.bounds.size.width;
    foreView.frame = frame;
}

@end
